import type { Module, ActionContext } from 'vuex'
import type { AxiosResponse } from 'axios'
import { getPersonStatistics } from '~/api/oam/opeHomepage'

const opeHomepage: Module<any, any> = {
  namespaced: true,
  actions: {
    // 获取 运维首页->个人统计
    GetPersonStatistics<S, T> (_: ActionContext<S, T>, params: T) {
      return new Promise((resolve, reject) => {
        getPersonStatistics<T>(params)
          .then((res: AxiosResponse) => {
            resolve(res.data)
          })
          .catch((err: AxiosResponse) => {
            reject(err)
          })
      })
    }
  }
}

export default opeHomepage
